package com.gxgeek.springbootquartz.task;//package com.gxgeek.springbootquartzdemo.task;
//
//import org.quartz.*;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.Trigger;
//import org.springframework.stereotype.Service;
//
//import java.util.Date;
//
///**
// * @author gaoxing
// * @create 2017-12-12 上午10:29
// */
//@Service
//public class QuartzEventServiceImpl implements QuartzEventService {
//    private static final String JOB_GROUP = "event_job_group";
//    private static final String TRIGGER_GROUP = "event_trigger_group";
//    @Autowired
//    private Scheduler scheduler;
//
//    @Override
//    public void addQuartz(Event event) throws SchedulerException {
//        JSONObject eventData = JSONObject.parseObject(event.getEventData());
//        Date triggerDate = eventData.getDate("date");
//        JobDetail job = JobBuilder.newJob(EventJob.class).withIdentity(event.getId().toString(), JOB_GROUP).usingJobData(buildJobDateMap(event)).build();
//        Trigger trigger = TriggerBuilder.newTrigger().withIdentity(event.getId().toString(), TRIGGER_GROUP).startAt(triggerDate).build();
//        scheduler.scheduleJob(job, trigger);
//    }
//}